bool isPopOrder(int* in; int* out; int nLength)
{


    if(in == NULL || NULL == out || nLength <= 0)
        return false;

    while(in != NULL || out != NULL || nLength > 0) //不能用空作为边界检查 要用长度
    {
        if(m1.top()!=*out || m1.size() == 0){
            m1.push(*in);
            in++;
        }
        if(m1.top() == *out && out != NULL){        //不能用空作为边界检查 要用长度
            m1.pop();
            out++;
        }
        if(out == NULL)
            return false;
        if(in == NULL)
            return true;
    }
}

bool isPopOrder(const int* pPush, const int* pPop, int nLength)
{
    bool bPossible = false;
    if(pPush != NULL && pPop != NULL && nLength>0)
    {
        const int* pNextPush = pPush;
        const int* pNextPop = pPop;

        std::stack<int>stackData;

        while(pNextPop - pPop < nLength){
            while(stackData.empty() || stackData.top() != *pNextPop){
                if(pNextPush-pPush == nLength){
                    break;
                }
                stackData.push(*pNextPush);
                pNextPush++;
            }
            if(stackData.top != *pNextPop)
                break;
            stackData.pop();
            pNextPop++;
        }
        if(stackData.empty() && pNextPop - pPop == nLength)
            bPossible = true;
    }
    return bPossible;
}